]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-widget: fix GList leak
authorPavel Vasin <rat4vier@gmail.com>
Mon, 18 Jun 2012 17:11:28 +0000 (21:11 +0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Sun, 24 Jun 2012 04:24:42 +0000 (00:24 -0400)
clutter_actor_get_children returns a newly allocated GList and it was
not freed.

However, as there's no reason to copy the children list, switch to
iterator api.

https://bugzilla.gnome.org/show_bug.cgi?id=678406

src/st/st-widget.c

index 88d05c19b7b37922572c5bd4c83a865f503d1466..9546c1c72dd737d39b4e19fc57904c2ff795a5af 100644 (file)
@@ -762,18 +762,17 @@ st_widget_get_paint_volume (ClutterActor *self,
 static GList *
 st_widget_real_get_focus_chain (StWidget *widget)
 {
-  GList *children;
+  ClutterActorIter iter;
+  ClutterActor *child;
   GList *focus_chain = NULL;
 
-  for (children = clutter_actor_get_children (CLUTTER_ACTOR (widget));
-       children;
-       children = children->next)
+  clutter_actor_iter_init (&iter, CLUTTER_ACTOR (widget));
+  while (clutter_actor_iter_next (&iter, &child))
     {
-      ClutterActor *child = children->data;
-
       if (CLUTTER_ACTOR_IS_VISIBLE (child))
         focus_chain = g_list_prepend (focus_chain, child);
     }
+
   return g_list_reverse (focus_chain);
 }